package models;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

import play.db.ebean.Model;

@Entity
public class ProvaAluno extends Model{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public long id;

	@Temporal(TemporalType.TIMESTAMP)
	public Date dtInicio;

	@Temporal(TemporalType.TIMESTAMP)
	public Date dtFim;
	
	@Min(0)
	@Max(100)
	public double nota;
	
	public boolean corrigida;

	@Temporal(TemporalType.DATE)
	public Date dtCadastro;
	
	// ------------------relacionamentos---------------------//
	@ManyToOne
	public Prova prova;
	
	@ManyToOne
	public Matricula aluno;
	
	@OneToMany(mappedBy="provaaluno")
	public List<ProvaAlunoQuestao> provaalunoquestoes = new ArrayList<ProvaAlunoQuestao>();
}
